<?php

require_once 'propel/om/BaseObject.php';

require_once 'propel/om/Persistent.php';


include_once 'propel/util/Criteria.php';

include_once 'cms/core/om/ImagePeer.php';

/**
 * Base class that represents a row from the 'image' table.
 *
 * 
 *
 * @package cms.core.om.om
 */
abstract class BaseImage extends BaseObject  implements Persistent {


	/**
	 * The Peer class.
	 * Instance provides a convenient way of calling static methods on a class
	 * that calling code may not be able to identify.
	 * @var ImagePeer
	 */
	protected static $peer;


	/**
	 * The value for the image_id field.
	 * @var int
	 */
	protected $image_id;


	/**
	 * The value for the width field.
	 * @var int
	 */
	protected $width;


	/**
	 * The value for the height field.
	 * @var int
	 */
	protected $height;


	/**
	 * The value for the insert_date field.
	 * @var int
	 */
	protected $insert_date;


	/**
	 * The value for the modified_date field.
	 * @var int
	 */
	protected $modified_date;


	/**
	 * The value for the secure field.
	 * @var boolean
	 */
	protected $secure = true;


	/**
	 * The value for the binary_file_id field.
	 * @var int
	 */
	protected $binary_file_id;

	/**
	 * @var BinaryFile
	 */
	protected $aBinaryFile;

	/**
	 * Collection to store aggregation of collContentsRelatedByThumbnailId.
	 * @var array
	 */
	protected $collContentsRelatedByThumbnailId;

	/**
	 * The criteria used to select the current contents of collContentsRelatedByThumbnailId.
	 * @var Criteria
	 */
	protected $lastContentRelatedByThumbnailIdCriteria = null;

	/**
	 * Collection to store aggregation of collContentsRelatedByImageId.
	 * @var array
	 */
	protected $collContentsRelatedByImageId;

	/**
	 * The criteria used to select the current contents of collContentsRelatedByImageId.
	 * @var Criteria
	 */
	protected $lastContentRelatedByImageIdCriteria = null;

	/**
	 * Collection to store aggregation of collCategorysRelatedByThumbnailId.
	 * @var array
	 */
	protected $collCategorysRelatedByThumbnailId;

	/**
	 * The criteria used to select the current contents of collCategorysRelatedByThumbnailId.
	 * @var Criteria
	 */
	protected $lastCategoryRelatedByThumbnailIdCriteria = null;

	/**
	 * Collection to store aggregation of collCategorysRelatedByImageId.
	 * @var array
	 */
	protected $collCategorysRelatedByImageId;

	/**
	 * The criteria used to select the current contents of collCategorysRelatedByImageId.
	 * @var Criteria
	 */
	protected $lastCategoryRelatedByImageIdCriteria = null;

	/**
	 * Collection to store aggregation of collDownloadsRelatedByThumbnailId.
	 * @var array
	 */
	protected $collDownloadsRelatedByThumbnailId;

	/**
	 * The criteria used to select the current contents of collDownloadsRelatedByThumbnailId.
	 * @var Criteria
	 */
	protected $lastDownloadRelatedByThumbnailIdCriteria = null;

	/**
	 * Collection to store aggregation of collDownloadsRelatedByImageId.
	 * @var array
	 */
	protected $collDownloadsRelatedByImageId;

	/**
	 * The criteria used to select the current contents of collDownloadsRelatedByImageId.
	 * @var Criteria
	 */
	protected $lastDownloadRelatedByImageIdCriteria = null;

	/**
	 * Collection to store aggregation of collEventsRelatedByThumbnailId.
	 * @var array
	 */
	protected $collEventsRelatedByThumbnailId;

	/**
	 * The criteria used to select the current contents of collEventsRelatedByThumbnailId.
	 * @var Criteria
	 */
	protected $lastEventRelatedByThumbnailIdCriteria = null;

	/**
	 * Collection to store aggregation of collEventsRelatedByImageId.
	 * @var array
	 */
	protected $collEventsRelatedByImageId;

	/**
	 * The criteria used to select the current contents of collEventsRelatedByImageId.
	 * @var Criteria
	 */
	protected $lastEventRelatedByImageIdCriteria = null;

	/**
	 * Collection to store aggregation of collGallerysRelatedByThumbnailId.
	 * @var array
	 */
	protected $collGallerysRelatedByThumbnailId;

	/**
	 * The criteria used to select the current contents of collGallerysRelatedByThumbnailId.
	 * @var Criteria
	 */
	protected $lastGalleryRelatedByThumbnailIdCriteria = null;

	/**
	 * Collection to store aggregation of collGallerysRelatedByImageId.
	 * @var array
	 */
	protected $collGallerysRelatedByImageId;

	/**
	 * The criteria used to select the current contents of collGallerysRelatedByImageId.
	 * @var Criteria
	 */
	protected $lastGalleryRelatedByImageIdCriteria = null;

	/**
	 * Collection to store aggregation of collGalleryImagesRelatedByThumbnailId.
	 * @var array
	 */
	protected $collGalleryImagesRelatedByThumbnailId;

	/**
	 * The criteria used to select the current contents of collGalleryImagesRelatedByThumbnailId.
	 * @var Criteria
	 */
	protected $lastGalleryImageRelatedByThumbnailIdCriteria = null;

	/**
	 * Collection to store aggregation of collGalleryImagesRelatedByImageId.
	 * @var array
	 */
	protected $collGalleryImagesRelatedByImageId;

	/**
	 * The criteria used to select the current contents of collGalleryImagesRelatedByImageId.
	 * @var Criteria
	 */
	protected $lastGalleryImageRelatedByImageIdCriteria = null;

	/**
	 * Collection to store aggregation of collGuidesRelatedByThumbnailId.
	 * @var array
	 */
	protected $collGuidesRelatedByThumbnailId;

	/**
	 * The criteria used to select the current contents of collGuidesRelatedByThumbnailId.
	 * @var Criteria
	 */
	protected $lastGuideRelatedByThumbnailIdCriteria = null;

	/**
	 * Collection to store aggregation of collGuidesRelatedByImageId.
	 * @var array
	 */
	protected $collGuidesRelatedByImageId;

	/**
	 * The criteria used to select the current contents of collGuidesRelatedByImageId.
	 * @var Criteria
	 */
	protected $lastGuideRelatedByImageIdCriteria = null;

	/**
	 * Collection to store aggregation of collTinyImagesRelatedByImageId.
	 * @var array
	 */
	protected $collTinyImagesRelatedByImageId;

	/**
	 * The criteria used to select the current contents of collTinyImagesRelatedByImageId.
	 * @var Criteria
	 */
	protected $lastTinyImageRelatedByImageIdCriteria = null;

	/**
	 * Collection to store aggregation of collTinyImagesRelatedByThumbnailId.
	 * @var array
	 */
	protected $collTinyImagesRelatedByThumbnailId;

	/**
	 * The criteria used to select the current contents of collTinyImagesRelatedByThumbnailId.
	 * @var Criteria
	 */
	protected $lastTinyImageRelatedByThumbnailIdCriteria = null;

	/**
	 * Collection to store aggregation of collMenuItemsRelatedByThumbnailId.
	 * @var array
	 */
	protected $collMenuItemsRelatedByThumbnailId;

	/**
	 * The criteria used to select the current contents of collMenuItemsRelatedByThumbnailId.
	 * @var Criteria
	 */
	protected $lastMenuItemRelatedByThumbnailIdCriteria = null;

	/**
	 * Collection to store aggregation of collMenuItemsRelatedByImageId.
	 * @var array
	 */
	protected $collMenuItemsRelatedByImageId;

	/**
	 * The criteria used to select the current contents of collMenuItemsRelatedByImageId.
	 * @var Criteria
	 */
	protected $lastMenuItemRelatedByImageIdCriteria = null;

	/**
	 * Collection to store aggregation of collProjectsRelatedByThumbnailId.
	 * @var array
	 */
	protected $collProjectsRelatedByThumbnailId;

	/**
	 * The criteria used to select the current contents of collProjectsRelatedByThumbnailId.
	 * @var Criteria
	 */
	protected $lastProjectRelatedByThumbnailIdCriteria = null;

	/**
	 * Collection to store aggregation of collProjectsRelatedByImageId.
	 * @var array
	 */
	protected $collProjectsRelatedByImageId;

	/**
	 * The criteria used to select the current contents of collProjectsRelatedByImageId.
	 * @var Criteria
	 */
	protected $lastProjectRelatedByImageIdCriteria = null;

	/**
	 * Collection to store aggregation of collStaffsRelatedByThumbnailId.
	 * @var array
	 */
	protected $collStaffsRelatedByThumbnailId;

	/**
	 * The criteria used to select the current contents of collStaffsRelatedByThumbnailId.
	 * @var Criteria
	 */
	protected $lastStaffRelatedByThumbnailIdCriteria = null;

	/**
	 * Collection to store aggregation of collStaffsRelatedByImageId.
	 * @var array
	 */
	protected $collStaffsRelatedByImageId;

	/**
	 * The criteria used to select the current contents of collStaffsRelatedByImageId.
	 * @var Criteria
	 */
	protected $lastStaffRelatedByImageIdCriteria = null;

	/**
	 * Flag to prevent endless save loop, if this object is referenced
	 * by another object which falls in this transaction.
	 * @var boolean
	 */
	protected $alreadyInSave = false;

	/**
	 * Flag to prevent endless validation loop, if this object is referenced
	 * by another object which falls in this transaction.
	 * @var boolean
	 */
	protected $alreadyInValidation = false;

	/**
	 * Get the [image_id] column value.
	 * 
	 * @return int
	 */
	public function getImageId()
	{

		return $this->image_id;
	}

	/**
	 * Get the [width] column value.
	 * 
	 * @return int
	 */
	public function getWidth()
	{

		return $this->width;
	}

	/**
	 * Get the [height] column value.
	 * 
	 * @return int
	 */
	public function getHeight()
	{

		return $this->height;
	}

	/**
	 * Get the [optionally formatted] [insert_date] column value.
	 * 
	 * @param string $format The date/time format string (either date()-style or strftime()-style).
	 *							If format is NULL, then the integer unix timestamp will be returned.
	 * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
	 * @throws PropelException - if unable to convert the date/time to timestamp.
	 */
	public function getInsertDate($format = 'Y-m-d H:i:s')
	{

		if ($this->insert_date === null || $this->insert_date === '') {
			return null;
		} elseif (!is_int($this->insert_date)) {
			// a non-timestamp value was set externally, so we convert it
			$ts = strtotime($this->insert_date);
			if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
				throw new PropelException("Unable to parse value of [insert_date] as date/time value: " . var_export($this->insert_date, true));
			}
		} else {
			$ts = $this->insert_date;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	/**
	 * Get the [optionally formatted] [modified_date] column value.
	 * 
	 * @param string $format The date/time format string (either date()-style or strftime()-style).
	 *							If format is NULL, then the integer unix timestamp will be returned.
	 * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
	 * @throws PropelException - if unable to convert the date/time to timestamp.
	 */
	public function getModifiedDate($format = 'Y-m-d H:i:s')
	{

		if ($this->modified_date === null || $this->modified_date === '') {
			return null;
		} elseif (!is_int($this->modified_date)) {
			// a non-timestamp value was set externally, so we convert it
			$ts = strtotime($this->modified_date);
			if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
				throw new PropelException("Unable to parse value of [modified_date] as date/time value: " . var_export($this->modified_date, true));
			}
		} else {
			$ts = $this->modified_date;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	/**
	 * Get the [secure] column value.
	 * 
	 * @return boolean
	 */
	public function getSecure()
	{

		return $this->secure;
	}

	/**
	 * Get the [binary_file_id] column value.
	 * 
	 * @return int
	 */
	public function getBinaryFileId()
	{

		return $this->binary_file_id;
	}

	/**
	 * Set the value of [image_id] column.
	 * 
	 * @param int $v new value
	 * @return void
	 */
	public function setImageId($v)
	{

		if ($this->image_id !== $v) {
			$this->image_id = $v;
			$this->modifiedColumns[] = ImagePeer::IMAGE_ID;
		}

	} // setImageId()

	/**
	 * Set the value of [width] column.
	 * 
	 * @param int $v new value
	 * @return void
	 */
	public function setWidth($v)
	{

		if ($this->width !== $v) {
			$this->width = $v;
			$this->modifiedColumns[] = ImagePeer::WIDTH;
		}

	} // setWidth()

	/**
	 * Set the value of [height] column.
	 * 
	 * @param int $v new value
	 * @return void
	 */
	public function setHeight($v)
	{

		if ($this->height !== $v) {
			$this->height = $v;
			$this->modifiedColumns[] = ImagePeer::HEIGHT;
		}

	} // setHeight()

	/**
	 * Set the value of [insert_date] column.
	 * 
	 * @param int $v new value
	 * @return void
	 */
	public function setInsertDate($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
				throw new PropelException("Unable to parse date/time value for [insert_date] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->insert_date !== $ts) {
			$this->insert_date = $ts;
			$this->modifiedColumns[] = ImagePeer::INSERT_DATE;
		}

	} // setInsertDate()

	/**
	 * Set the value of [modified_date] column.
	 * 
	 * @param int $v new value
	 * @return void
	 */
	public function setModifiedDate($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
				throw new PropelException("Unable to parse date/time value for [modified_date] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->modified_date !== $ts) {
			$this->modified_date = $ts;
			$this->modifiedColumns[] = ImagePeer::MODIFIED_DATE;
		}

	} // setModifiedDate()

	/**
	 * Set the value of [secure] column.
	 * 
	 * @param boolean $v new value
	 * @return void
	 */
	public function setSecure($v)
	{

		if ($this->secure !== $v || $v === true) {
			$this->secure = $v;
			$this->modifiedColumns[] = ImagePeer::SECURE;
		}

	} // setSecure()

	/**
	 * Set the value of [binary_file_id] column.
	 * 
	 * @param int $v new value
	 * @return void
	 */
	public function setBinaryFileId($v)
	{

		if ($this->binary_file_id !== $v) {
			$this->binary_file_id = $v;
			$this->modifiedColumns[] = ImagePeer::BINARY_FILE_ID;
		}

		if ($this->aBinaryFile !== null && $this->aBinaryFile->getBinaryFileId() !== $v) {
			$this->aBinaryFile = null;
		}

	} // setBinaryFileId()

	/**
	 * Hydrates (populates) the object variables with values from the database resultset.
	 *
	 * An offset (1-based "start column") is specified so that objects can be hydrated
	 * with a subset of the columns in the resultset rows.  This is needed, for example,
	 * for results of JOIN queries where the resultset row includes columns from two or
	 * more tables.
	 *
	 * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
	 * @param int $startcol 1-based offset column which indicates which restultset column to start with.
	 * @return int next starting column
	 * @throws PropelException  - Any caught Exception will be rewrapped as a PropelException.
	 */
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->image_id = $rs->getInt($startcol + 0);

			$this->width = $rs->getInt($startcol + 1);

			$this->height = $rs->getInt($startcol + 2);

			$this->insert_date = $rs->getTimestamp($startcol + 3, null);

			$this->modified_date = $rs->getTimestamp($startcol + 4, null);

			$this->secure = $rs->getBoolean($startcol + 5);

			$this->binary_file_id = $rs->getInt($startcol + 6);

			$this->setNew(false);

			// FIXME - using NUM_COLUMNS may be clearer.
			return $startcol + 7; // 7 = ImagePeer::NUM_COLUMNS - ImagePeer::NUM_LAZY_LOAD_COLUMNS).

		} catch (Exception $e) {
			throw new PropelException("Error populating Image object", $e);
		}
	}

	/**
	 * Removes this object from datastore and sets delete attribute.
	 *
	 * @param Connection $con
	 * @return void
	 * @throws PropelException
	 * @see BaseObject::setDeleted()
	 * @see BaseObject::isDeleted()
	 */
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(ImagePeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			ImagePeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	/**
	 * Stores the object in the database.  If the object is new,
	 * it inserts it; otherwise an update is performed.  This method
	 * wraps the doSave() worker method in a transaction.
	 *
	 * @param Connection $con
	 * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
	 * @throws PropelException
	 * @see doSave()
	 */
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(ImagePeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	/**
	 * Stores the object in the database.
	 *
	 * If the object is new, it inserts it; otherwise an update is performed.
	 * All related objects are also updated in this method.
	 *
	 * @param Connection $con
	 * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
	 * @throws PropelException
	 * @see save()
	 */
	protected function doSave($con)
	{
		$affectedRows = 0; // initialize var to track total num of affected rows
		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


			// We call the save method on the following object(s) if they
			// were passed to this object by their coresponding set
			// method.  This object relates to these object(s) by a
			// foreign key reference.

			if ($this->aBinaryFile !== null) {
				if ($this->aBinaryFile->isModified()) {
					$affectedRows += $this->aBinaryFile->save($con);
				}
				$this->setBinaryFile($this->aBinaryFile);
			}


			// If this object has been modified, then save it to the database.
			if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = ImagePeer::doInsert($this, $con);
					$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
										 // should always be true here (even though technically
										 // BasePeer::doInsert() can insert multiple rows).

					$this->setImageId($pk);  //[IMV] update autoincrement primary key

					$this->setNew(false);
				} else {
					$affectedRows += ImagePeer::doUpdate($this, $con);
				}
				$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
			}

			if ($this->collContentsRelatedByThumbnailId !== null) {
				foreach($this->collContentsRelatedByThumbnailId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collContentsRelatedByImageId !== null) {
				foreach($this->collContentsRelatedByImageId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collCategorysRelatedByThumbnailId !== null) {
				foreach($this->collCategorysRelatedByThumbnailId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collCategorysRelatedByImageId !== null) {
				foreach($this->collCategorysRelatedByImageId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collDownloadsRelatedByThumbnailId !== null) {
				foreach($this->collDownloadsRelatedByThumbnailId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collDownloadsRelatedByImageId !== null) {
				foreach($this->collDownloadsRelatedByImageId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collEventsRelatedByThumbnailId !== null) {
				foreach($this->collEventsRelatedByThumbnailId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collEventsRelatedByImageId !== null) {
				foreach($this->collEventsRelatedByImageId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collGallerysRelatedByThumbnailId !== null) {
				foreach($this->collGallerysRelatedByThumbnailId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collGallerysRelatedByImageId !== null) {
				foreach($this->collGallerysRelatedByImageId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collGalleryImagesRelatedByThumbnailId !== null) {
				foreach($this->collGalleryImagesRelatedByThumbnailId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collGalleryImagesRelatedByImageId !== null) {
				foreach($this->collGalleryImagesRelatedByImageId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collGuidesRelatedByThumbnailId !== null) {
				foreach($this->collGuidesRelatedByThumbnailId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collGuidesRelatedByImageId !== null) {
				foreach($this->collGuidesRelatedByImageId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collTinyImagesRelatedByImageId !== null) {
				foreach($this->collTinyImagesRelatedByImageId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collTinyImagesRelatedByThumbnailId !== null) {
				foreach($this->collTinyImagesRelatedByThumbnailId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collMenuItemsRelatedByThumbnailId !== null) {
				foreach($this->collMenuItemsRelatedByThumbnailId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collMenuItemsRelatedByImageId !== null) {
				foreach($this->collMenuItemsRelatedByImageId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collProjectsRelatedByThumbnailId !== null) {
				foreach($this->collProjectsRelatedByThumbnailId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collProjectsRelatedByImageId !== null) {
				foreach($this->collProjectsRelatedByImageId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collStaffsRelatedByThumbnailId !== null) {
				foreach($this->collStaffsRelatedByThumbnailId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collStaffsRelatedByImageId !== null) {
				foreach($this->collStaffsRelatedByImageId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} // doSave()

	/**
	 * Array of ValidationFailed objects.
	 * @var array ValidationFailed[]
	 */
	protected $validationFailures = array();

	/**
	 * Gets any ValidationFailed objects that resulted from last call to validate().
	 *
	 *
	 * @return array ValidationFailed[]
	 * @see validate()
	 */
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	/**
	 * Validates the objects modified field values and all objects related to this table.
	 *
	 * If $columns is either a column name or an array of column names
	 * only those columns are validated.
	 *
	 * @param mixed $columns Column name or an array of column names.
	 * @return boolean Whether all columns pass validation.
	 * @see doValidate()
	 * @see getValidationFailures()
	 */
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	/**
	 * This function performs the validation work for complex object models.
	 *
	 * In addition to checking the current object, all related objects will
	 * also be validated.  If all pass then <code>true</code> is returned; otherwise
	 * an aggreagated array of ValidationFailed objects will be returned.
	 *
	 * @param array $columns Array of column names to validate.
	 * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
	 */
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			// We call the validate method on the following object(s) if they
			// were passed to this object by their coresponding set
			// method.  This object relates to these object(s) by a
			// foreign key reference.

			if ($this->aBinaryFile !== null) {
				if (!$this->aBinaryFile->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aBinaryFile->getValidationFailures());
				}
			}


			if (($retval = ImagePeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collContentsRelatedByThumbnailId !== null) {
					foreach($this->collContentsRelatedByThumbnailId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collContentsRelatedByImageId !== null) {
					foreach($this->collContentsRelatedByImageId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collCategorysRelatedByThumbnailId !== null) {
					foreach($this->collCategorysRelatedByThumbnailId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collCategorysRelatedByImageId !== null) {
					foreach($this->collCategorysRelatedByImageId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collDownloadsRelatedByThumbnailId !== null) {
					foreach($this->collDownloadsRelatedByThumbnailId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collDownloadsRelatedByImageId !== null) {
					foreach($this->collDownloadsRelatedByImageId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collEventsRelatedByThumbnailId !== null) {
					foreach($this->collEventsRelatedByThumbnailId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collEventsRelatedByImageId !== null) {
					foreach($this->collEventsRelatedByImageId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collGallerysRelatedByThumbnailId !== null) {
					foreach($this->collGallerysRelatedByThumbnailId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collGallerysRelatedByImageId !== null) {
					foreach($this->collGallerysRelatedByImageId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collGalleryImagesRelatedByThumbnailId !== null) {
					foreach($this->collGalleryImagesRelatedByThumbnailId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collGalleryImagesRelatedByImageId !== null) {
					foreach($this->collGalleryImagesRelatedByImageId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collGuidesRelatedByThumbnailId !== null) {
					foreach($this->collGuidesRelatedByThumbnailId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collGuidesRelatedByImageId !== null) {
					foreach($this->collGuidesRelatedByImageId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collTinyImagesRelatedByImageId !== null) {
					foreach($this->collTinyImagesRelatedByImageId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collTinyImagesRelatedByThumbnailId !== null) {
					foreach($this->collTinyImagesRelatedByThumbnailId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collMenuItemsRelatedByThumbnailId !== null) {
					foreach($this->collMenuItemsRelatedByThumbnailId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collMenuItemsRelatedByImageId !== null) {
					foreach($this->collMenuItemsRelatedByImageId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collProjectsRelatedByThumbnailId !== null) {
					foreach($this->collProjectsRelatedByThumbnailId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collProjectsRelatedByImageId !== null) {
					foreach($this->collProjectsRelatedByImageId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collStaffsRelatedByThumbnailId !== null) {
					foreach($this->collStaffsRelatedByThumbnailId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collStaffsRelatedByImageId !== null) {
					foreach($this->collStaffsRelatedByImageId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	/**
	 * Retrieves a field from the object by name passed in as a string.
	 *
	 * @param string $name name
	 * @param string $type The type of fieldname the $name is of:
	 *                     one of the class type constants TYPE_PHPNAME,
	 *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @return mixed Value of field.
	 */
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = ImagePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	/**
	 * Retrieves a field from the object by Position as specified in the xml schema.
	 * Zero-based.
	 *
	 * @param int $pos position in xml schema
	 * @return mixed Value of field at $pos
	 */
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getImageId();
				break;
			case 1:
				return $this->getWidth();
				break;
			case 2:
				return $this->getHeight();
				break;
			case 3:
				return $this->getInsertDate();
				break;
			case 4:
				return $this->getModifiedDate();
				break;
			case 5:
				return $this->getSecure();
				break;
			case 6:
				return $this->getBinaryFileId();
				break;
			default:
				return null;
				break;
		} // switch()
	}

	/**
	 * Exports the object as an array.
	 *
	 * You can specify the key type of the array by passing one of the class
	 * type constants.
	 *
	 * @param string $keyType One of the class type constants TYPE_PHPNAME,
	 *                        TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @return an associative array containing the field names (as keys) and field values
	 */
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = ImagePeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getImageId(),
			$keys[1] => $this->getWidth(),
			$keys[2] => $this->getHeight(),
			$keys[3] => $this->getInsertDate(),
			$keys[4] => $this->getModifiedDate(),
			$keys[5] => $this->getSecure(),
			$keys[6] => $this->getBinaryFileId(),
		);
		return $result;
	}

	/**
	 * Sets a field from the object by name passed in as a string.
	 *
	 * @param string $name peer name
	 * @param mixed $value field value
	 * @param string $type The type of fieldname the $name is of:
	 *                     one of the class type constants TYPE_PHPNAME,
	 *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @return void
	 */
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = ImagePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	/**
	 * Sets a field from the object by Position as specified in the xml schema.
	 * Zero-based.
	 *
	 * @param int $pos position in xml schema
	 * @param mixed $value field value
	 * @return void
	 */
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setImageId($value);
				break;
			case 1:
				$this->setWidth($value);
				break;
			case 2:
				$this->setHeight($value);
				break;
			case 3:
				$this->setInsertDate($value);
				break;
			case 4:
				$this->setModifiedDate($value);
				break;
			case 5:
				$this->setSecure($value);
				break;
			case 6:
				$this->setBinaryFileId($value);
				break;
		} // switch()
	}

	/**
	 * Populates the object using an array.
	 *
	 * This is particularly useful when populating an object from one of the
	 * request arrays (e.g. $_POST).  This method goes through the column
	 * names, checking to see whether a matching key exists in populated
	 * array. If so the setByName() method is called for that column.
	 *
	 * You can specify the key type of the array by additionally passing one
	 * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
	 * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
	 *
	 * @param array  $arr     An array to populate the object from.
	 * @param string $keyType The type of keys the array uses.
	 * @return void
	 */
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = ImagePeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setImageId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setWidth($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setHeight($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setInsertDate($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setModifiedDate($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setSecure($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setBinaryFileId($arr[$keys[6]]);
	}

	/**
	 * Build a Criteria object containing the values of all modified columns in this object.
	 *
	 * @return Criteria The Criteria object containing all modified values.
	 */
	public function buildCriteria()
	{
		$criteria = new Criteria(ImagePeer::DATABASE_NAME);

		if ($this->isColumnModified(ImagePeer::IMAGE_ID)) $criteria->add(ImagePeer::IMAGE_ID, $this->image_id);
		if ($this->isColumnModified(ImagePeer::WIDTH)) $criteria->add(ImagePeer::WIDTH, $this->width);
		if ($this->isColumnModified(ImagePeer::HEIGHT)) $criteria->add(ImagePeer::HEIGHT, $this->height);
		if ($this->isColumnModified(ImagePeer::INSERT_DATE)) $criteria->add(ImagePeer::INSERT_DATE, $this->insert_date);
		if ($this->isColumnModified(ImagePeer::MODIFIED_DATE)) $criteria->add(ImagePeer::MODIFIED_DATE, $this->modified_date);
		if ($this->isColumnModified(ImagePeer::SECURE)) $criteria->add(ImagePeer::SECURE, $this->secure);
		if ($this->isColumnModified(ImagePeer::BINARY_FILE_ID)) $criteria->add(ImagePeer::BINARY_FILE_ID, $this->binary_file_id);

		return $criteria;
	}

	/**
	 * Builds a Criteria object containing the primary key for this object.
	 *
	 * Unlike buildCriteria() this method includes the primary key values regardless
	 * of whether or not they have been modified.
	 *
	 * @return Criteria The Criteria object containing value(s) for primary key(s).
	 */
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(ImagePeer::DATABASE_NAME);

		$criteria->add(ImagePeer::IMAGE_ID, $this->image_id);

		return $criteria;
	}

	/**
	 * Returns the primary key for this object (row).
	 * @return int
	 */
	public function getPrimaryKey()
	{
		return $this->getImageId();
	}

	/**
	 * Generic method to set the primary key (image_id column).
	 *
	 * @param int $key Primary key.
	 * @return void
	 */
	public function setPrimaryKey($key)
	{
		$this->setImageId($key);
	}

	/**
	 * Sets contents of passed object to values from current object.
	 *
	 * If desired, this method can also make copies of all associated (fkey referrers)
	 * objects.
	 *
	 * @param object $copyObj An object of Image (or compatible) type.
	 * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
	 * @throws PropelException
	 */
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setWidth($this->width);

		$copyObj->setHeight($this->height);

		$copyObj->setInsertDate($this->insert_date);

		$copyObj->setModifiedDate($this->modified_date);

		$copyObj->setSecure($this->secure);

		$copyObj->setBinaryFileId($this->binary_file_id);


		if ($deepCopy) {
			// important: temporarily setNew(false) because this affects the behavior of
			// the getter/setter methods for fkey referrer objects.
			$copyObj->setNew(false);

			foreach($this->getContentsRelatedByThumbnailId() as $relObj) {
				$copyObj->addContentRelatedByThumbnailId($relObj->copy($deepCopy));
			}

			foreach($this->getContentsRelatedByImageId() as $relObj) {
				$copyObj->addContentRelatedByImageId($relObj->copy($deepCopy));
			}

			foreach($this->getCategorysRelatedByThumbnailId() as $relObj) {
				$copyObj->addCategoryRelatedByThumbnailId($relObj->copy($deepCopy));
			}

			foreach($this->getCategorysRelatedByImageId() as $relObj) {
				$copyObj->addCategoryRelatedByImageId($relObj->copy($deepCopy));
			}

			foreach($this->getDownloadsRelatedByThumbnailId() as $relObj) {
				$copyObj->addDownloadRelatedByThumbnailId($relObj->copy($deepCopy));
			}

			foreach($this->getDownloadsRelatedByImageId() as $relObj) {
				$copyObj->addDownloadRelatedByImageId($relObj->copy($deepCopy));
			}

			foreach($this->getEventsRelatedByThumbnailId() as $relObj) {
				$copyObj->addEventRelatedByThumbnailId($relObj->copy($deepCopy));
			}

			foreach($this->getEventsRelatedByImageId() as $relObj) {
				$copyObj->addEventRelatedByImageId($relObj->copy($deepCopy));
			}

			foreach($this->getGallerysRelatedByThumbnailId() as $relObj) {
				$copyObj->addGalleryRelatedByThumbnailId($relObj->copy($deepCopy));
			}

			foreach($this->getGallerysRelatedByImageId() as $relObj) {
				$copyObj->addGalleryRelatedByImageId($relObj->copy($deepCopy));
			}

			foreach($this->getGalleryImagesRelatedByThumbnailId() as $relObj) {
				$copyObj->addGalleryImageRelatedByThumbnailId($relObj->copy($deepCopy));
			}

			foreach($this->getGalleryImagesRelatedByImageId() as $relObj) {
				$copyObj->addGalleryImageRelatedByImageId($relObj->copy($deepCopy));
			}

			foreach($this->getGuidesRelatedByThumbnailId() as $relObj) {
				$copyObj->addGuideRelatedByThumbnailId($relObj->copy($deepCopy));
			}

			foreach($this->getGuidesRelatedByImageId() as $relObj) {
				$copyObj->addGuideRelatedByImageId($relObj->copy($deepCopy));
			}

			foreach($this->getTinyImagesRelatedByImageId() as $relObj) {
				$copyObj->addTinyImageRelatedByImageId($relObj->copy($deepCopy));
			}

			foreach($this->getTinyImagesRelatedByThumbnailId() as $relObj) {
				$copyObj->addTinyImageRelatedByThumbnailId($relObj->copy($deepCopy));
			}

			foreach($this->getMenuItemsRelatedByThumbnailId() as $relObj) {
				$copyObj->addMenuItemRelatedByThumbnailId($relObj->copy($deepCopy));
			}

			foreach($this->getMenuItemsRelatedByImageId() as $relObj) {
				$copyObj->addMenuItemRelatedByImageId($relObj->copy($deepCopy));
			}

			foreach($this->getProjectsRelatedByThumbnailId() as $relObj) {
				$copyObj->addProjectRelatedByThumbnailId($relObj->copy($deepCopy));
			}

			foreach($this->getProjectsRelatedByImageId() as $relObj) {
				$copyObj->addProjectRelatedByImageId($relObj->copy($deepCopy));
			}

			foreach($this->getStaffsRelatedByThumbnailId() as $relObj) {
				$copyObj->addStaffRelatedByThumbnailId($relObj->copy($deepCopy));
			}

			foreach($this->getStaffsRelatedByImageId() as $relObj) {
				$copyObj->addStaffRelatedByImageId($relObj->copy($deepCopy));
			}

		} // if ($deepCopy)


		$copyObj->setNew(true);

		$copyObj->setImageId(NULL); // this is a pkey column, so set to default value

	}

	/**
	 * Makes a copy of this object that will be inserted as a new row in table when saved.
	 * It creates a new object filling in the simple attributes, but skipping any primary
	 * keys that are defined for the table.
	 *
	 * If desired, this method can also make copies of all associated (fkey referrers)
	 * objects.
	 *
	 * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
	 * @return Image Clone of current object.
	 * @throws PropelException
	 */
	public function copy($deepCopy = false)
	{
		// we use get_class(), because this might be a subclass
		$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	/**
	 * Returns a peer instance associated with this om.
	 *
	 * Since Peer classes are not to have any instance attributes, this method returns the
	 * same instance for all member of this class. The method could therefore
	 * be static, but this would prevent one from overriding the behavior.
	 *
	 * @return ImagePeer
	 */
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new ImagePeer();
		}
		return self::$peer;
	}

	/**
	 * Declares an association between this object and a BinaryFile object.
	 *
	 * @param BinaryFile $v
	 * @return void
	 * @throws PropelException
	 */
	public function setBinaryFile($v)
	{


		if ($v === null) {
			$this->setBinaryFileId(NULL);
		} else {
			$this->setBinaryFileId($v->getBinaryFileId());
		}


		$this->aBinaryFile = $v;
	}


	/**
	 * Get the associated BinaryFile object
	 *
	 * @param Connection Optional Connection object.
	 * @return BinaryFile The associated BinaryFile object.
	 * @throws PropelException
	 */
	public function getBinaryFile($con = null)
	{
		// include the related Peer class
		include_once 'cms/core/om/om/BaseBinaryFilePeer.php';

		if ($this->aBinaryFile === null && ($this->binary_file_id !== null)) {

			$this->aBinaryFile = BinaryFilePeer::retrieveByPK($this->binary_file_id, $con);

			/* The following can be used instead of the line above to
			   guarantee the related object contains a reference
			   to this object, but this level of coupling
			   may be undesirable in many circumstances.
			   As it can lead to a db query with many results that may
			   never be used.
			   $obj = BinaryFilePeer::retrieveByPK($this->binary_file_id, $con);
			   $obj->addBinaryFiles($this);
			 */
		}
		return $this->aBinaryFile;
	}

	/**
	 * Temporary storage of collContentsRelatedByThumbnailId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initContentsRelatedByThumbnailId()
	{
		if ($this->collContentsRelatedByThumbnailId === null) {
			$this->collContentsRelatedByThumbnailId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related ContentsRelatedByThumbnailId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getContentsRelatedByThumbnailId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/content/om/om/BaseContentPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collContentsRelatedByThumbnailId === null) {
			if ($this->isNew()) {
			   $this->collContentsRelatedByThumbnailId = array();
			} else {

				$criteria->add(ContentPeer::THUMBNAIL_ID, $this->getImageId());

				ContentPeer::addSelectColumns($criteria);
				$this->collContentsRelatedByThumbnailId = ContentPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(ContentPeer::THUMBNAIL_ID, $this->getImageId());

				ContentPeer::addSelectColumns($criteria);
				if (!isset($this->lastContentRelatedByThumbnailIdCriteria) || !$this->lastContentRelatedByThumbnailIdCriteria->equals($criteria)) {
					$this->collContentsRelatedByThumbnailId = ContentPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastContentRelatedByThumbnailIdCriteria = $criteria;
		return $this->collContentsRelatedByThumbnailId;
	}

	/**
	 * Returns the number of related ContentsRelatedByThumbnailId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countContentsRelatedByThumbnailId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/content/om/om/BaseContentPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ContentPeer::THUMBNAIL_ID, $this->getImageId());

		return ContentPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Content object to this object
	 * through the Content foreign key attribute
	 *
	 * @param Content $l Content
	 * @return void
	 * @throws PropelException
	 */
	public function addContentRelatedByThumbnailId(Content $l)
	{
		$this->collContentsRelatedByThumbnailId[] = $l;
		$l->setImageRelatedByThumbnailId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related ContentsRelatedByThumbnailId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getContentsRelatedByThumbnailIdJoinCategory($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/content/om/om/BaseContentPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collContentsRelatedByThumbnailId === null) {
			if ($this->isNew()) {
				$this->collContentsRelatedByThumbnailId = array();
			} else {

				$criteria->add(ContentPeer::THUMBNAIL_ID, $this->getImageId());

				$this->collContentsRelatedByThumbnailId = ContentPeer::doSelectJoinCategory($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(ContentPeer::THUMBNAIL_ID, $this->getImageId());

			if (!isset($this->lastContentRelatedByThumbnailIdCriteria) || !$this->lastContentRelatedByThumbnailIdCriteria->equals($criteria)) {
				$this->collContentsRelatedByThumbnailId = ContentPeer::doSelectJoinCategory($criteria, $con);
			}
		}
		$this->lastContentRelatedByThumbnailIdCriteria = $criteria;

		return $this->collContentsRelatedByThumbnailId;
	}

	/**
	 * Temporary storage of collContentsRelatedByImageId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initContentsRelatedByImageId()
	{
		if ($this->collContentsRelatedByImageId === null) {
			$this->collContentsRelatedByImageId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related ContentsRelatedByImageId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getContentsRelatedByImageId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/content/om/om/BaseContentPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collContentsRelatedByImageId === null) {
			if ($this->isNew()) {
			   $this->collContentsRelatedByImageId = array();
			} else {

				$criteria->add(ContentPeer::IMAGE_ID, $this->getImageId());

				ContentPeer::addSelectColumns($criteria);
				$this->collContentsRelatedByImageId = ContentPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(ContentPeer::IMAGE_ID, $this->getImageId());

				ContentPeer::addSelectColumns($criteria);
				if (!isset($this->lastContentRelatedByImageIdCriteria) || !$this->lastContentRelatedByImageIdCriteria->equals($criteria)) {
					$this->collContentsRelatedByImageId = ContentPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastContentRelatedByImageIdCriteria = $criteria;
		return $this->collContentsRelatedByImageId;
	}

	/**
	 * Returns the number of related ContentsRelatedByImageId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countContentsRelatedByImageId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/content/om/om/BaseContentPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ContentPeer::IMAGE_ID, $this->getImageId());

		return ContentPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Content object to this object
	 * through the Content foreign key attribute
	 *
	 * @param Content $l Content
	 * @return void
	 * @throws PropelException
	 */
	public function addContentRelatedByImageId(Content $l)
	{
		$this->collContentsRelatedByImageId[] = $l;
		$l->setImageRelatedByImageId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related ContentsRelatedByImageId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getContentsRelatedByImageIdJoinCategory($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/content/om/om/BaseContentPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collContentsRelatedByImageId === null) {
			if ($this->isNew()) {
				$this->collContentsRelatedByImageId = array();
			} else {

				$criteria->add(ContentPeer::IMAGE_ID, $this->getImageId());

				$this->collContentsRelatedByImageId = ContentPeer::doSelectJoinCategory($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(ContentPeer::IMAGE_ID, $this->getImageId());

			if (!isset($this->lastContentRelatedByImageIdCriteria) || !$this->lastContentRelatedByImageIdCriteria->equals($criteria)) {
				$this->collContentsRelatedByImageId = ContentPeer::doSelectJoinCategory($criteria, $con);
			}
		}
		$this->lastContentRelatedByImageIdCriteria = $criteria;

		return $this->collContentsRelatedByImageId;
	}

	/**
	 * Temporary storage of collCategorysRelatedByThumbnailId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initCategorysRelatedByThumbnailId()
	{
		if ($this->collCategorysRelatedByThumbnailId === null) {
			$this->collCategorysRelatedByThumbnailId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related CategorysRelatedByThumbnailId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getCategorysRelatedByThumbnailId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/core/om/om/BaseCategoryPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collCategorysRelatedByThumbnailId === null) {
			if ($this->isNew()) {
			   $this->collCategorysRelatedByThumbnailId = array();
			} else {

				$criteria->add(CategoryPeer::THUMBNAIL_ID, $this->getImageId());

				CategoryPeer::addSelectColumns($criteria);
				$this->collCategorysRelatedByThumbnailId = CategoryPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(CategoryPeer::THUMBNAIL_ID, $this->getImageId());

				CategoryPeer::addSelectColumns($criteria);
				if (!isset($this->lastCategoryRelatedByThumbnailIdCriteria) || !$this->lastCategoryRelatedByThumbnailIdCriteria->equals($criteria)) {
					$this->collCategorysRelatedByThumbnailId = CategoryPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastCategoryRelatedByThumbnailIdCriteria = $criteria;
		return $this->collCategorysRelatedByThumbnailId;
	}

	/**
	 * Returns the number of related CategorysRelatedByThumbnailId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countCategorysRelatedByThumbnailId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/core/om/om/BaseCategoryPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(CategoryPeer::THUMBNAIL_ID, $this->getImageId());

		return CategoryPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Category object to this object
	 * through the Category foreign key attribute
	 *
	 * @param Category $l Category
	 * @return void
	 * @throws PropelException
	 */
	public function addCategoryRelatedByThumbnailId(Category $l)
	{
		$this->collCategorysRelatedByThumbnailId[] = $l;
		$l->setImageRelatedByThumbnailId($this);
	}

	/**
	 * Temporary storage of collCategorysRelatedByImageId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initCategorysRelatedByImageId()
	{
		if ($this->collCategorysRelatedByImageId === null) {
			$this->collCategorysRelatedByImageId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related CategorysRelatedByImageId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getCategorysRelatedByImageId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/core/om/om/BaseCategoryPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collCategorysRelatedByImageId === null) {
			if ($this->isNew()) {
			   $this->collCategorysRelatedByImageId = array();
			} else {

				$criteria->add(CategoryPeer::IMAGE_ID, $this->getImageId());

				CategoryPeer::addSelectColumns($criteria);
				$this->collCategorysRelatedByImageId = CategoryPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(CategoryPeer::IMAGE_ID, $this->getImageId());

				CategoryPeer::addSelectColumns($criteria);
				if (!isset($this->lastCategoryRelatedByImageIdCriteria) || !$this->lastCategoryRelatedByImageIdCriteria->equals($criteria)) {
					$this->collCategorysRelatedByImageId = CategoryPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastCategoryRelatedByImageIdCriteria = $criteria;
		return $this->collCategorysRelatedByImageId;
	}

	/**
	 * Returns the number of related CategorysRelatedByImageId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countCategorysRelatedByImageId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/core/om/om/BaseCategoryPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(CategoryPeer::IMAGE_ID, $this->getImageId());

		return CategoryPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Category object to this object
	 * through the Category foreign key attribute
	 *
	 * @param Category $l Category
	 * @return void
	 * @throws PropelException
	 */
	public function addCategoryRelatedByImageId(Category $l)
	{
		$this->collCategorysRelatedByImageId[] = $l;
		$l->setImageRelatedByImageId($this);
	}

	/**
	 * Temporary storage of collDownloadsRelatedByThumbnailId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initDownloadsRelatedByThumbnailId()
	{
		if ($this->collDownloadsRelatedByThumbnailId === null) {
			$this->collDownloadsRelatedByThumbnailId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related DownloadsRelatedByThumbnailId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getDownloadsRelatedByThumbnailId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/download/om/om/BaseDownloadPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collDownloadsRelatedByThumbnailId === null) {
			if ($this->isNew()) {
			   $this->collDownloadsRelatedByThumbnailId = array();
			} else {

				$criteria->add(DownloadPeer::THUMBNAIL_ID, $this->getImageId());

				DownloadPeer::addSelectColumns($criteria);
				$this->collDownloadsRelatedByThumbnailId = DownloadPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(DownloadPeer::THUMBNAIL_ID, $this->getImageId());

				DownloadPeer::addSelectColumns($criteria);
				if (!isset($this->lastDownloadRelatedByThumbnailIdCriteria) || !$this->lastDownloadRelatedByThumbnailIdCriteria->equals($criteria)) {
					$this->collDownloadsRelatedByThumbnailId = DownloadPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastDownloadRelatedByThumbnailIdCriteria = $criteria;
		return $this->collDownloadsRelatedByThumbnailId;
	}

	/**
	 * Returns the number of related DownloadsRelatedByThumbnailId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countDownloadsRelatedByThumbnailId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/download/om/om/BaseDownloadPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(DownloadPeer::THUMBNAIL_ID, $this->getImageId());

		return DownloadPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Download object to this object
	 * through the Download foreign key attribute
	 *
	 * @param Download $l Download
	 * @return void
	 * @throws PropelException
	 */
	public function addDownloadRelatedByThumbnailId(Download $l)
	{
		$this->collDownloadsRelatedByThumbnailId[] = $l;
		$l->setImageRelatedByThumbnailId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related DownloadsRelatedByThumbnailId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getDownloadsRelatedByThumbnailIdJoinCategory($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/download/om/om/BaseDownloadPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collDownloadsRelatedByThumbnailId === null) {
			if ($this->isNew()) {
				$this->collDownloadsRelatedByThumbnailId = array();
			} else {

				$criteria->add(DownloadPeer::THUMBNAIL_ID, $this->getImageId());

				$this->collDownloadsRelatedByThumbnailId = DownloadPeer::doSelectJoinCategory($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(DownloadPeer::THUMBNAIL_ID, $this->getImageId());

			if (!isset($this->lastDownloadRelatedByThumbnailIdCriteria) || !$this->lastDownloadRelatedByThumbnailIdCriteria->equals($criteria)) {
				$this->collDownloadsRelatedByThumbnailId = DownloadPeer::doSelectJoinCategory($criteria, $con);
			}
		}
		$this->lastDownloadRelatedByThumbnailIdCriteria = $criteria;

		return $this->collDownloadsRelatedByThumbnailId;
	}

	/**
	 * Temporary storage of collDownloadsRelatedByImageId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initDownloadsRelatedByImageId()
	{
		if ($this->collDownloadsRelatedByImageId === null) {
			$this->collDownloadsRelatedByImageId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related DownloadsRelatedByImageId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getDownloadsRelatedByImageId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/download/om/om/BaseDownloadPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collDownloadsRelatedByImageId === null) {
			if ($this->isNew()) {
			   $this->collDownloadsRelatedByImageId = array();
			} else {

				$criteria->add(DownloadPeer::IMAGE_ID, $this->getImageId());

				DownloadPeer::addSelectColumns($criteria);
				$this->collDownloadsRelatedByImageId = DownloadPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(DownloadPeer::IMAGE_ID, $this->getImageId());

				DownloadPeer::addSelectColumns($criteria);
				if (!isset($this->lastDownloadRelatedByImageIdCriteria) || !$this->lastDownloadRelatedByImageIdCriteria->equals($criteria)) {
					$this->collDownloadsRelatedByImageId = DownloadPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastDownloadRelatedByImageIdCriteria = $criteria;
		return $this->collDownloadsRelatedByImageId;
	}

	/**
	 * Returns the number of related DownloadsRelatedByImageId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countDownloadsRelatedByImageId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/download/om/om/BaseDownloadPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(DownloadPeer::IMAGE_ID, $this->getImageId());

		return DownloadPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Download object to this object
	 * through the Download foreign key attribute
	 *
	 * @param Download $l Download
	 * @return void
	 * @throws PropelException
	 */
	public function addDownloadRelatedByImageId(Download $l)
	{
		$this->collDownloadsRelatedByImageId[] = $l;
		$l->setImageRelatedByImageId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related DownloadsRelatedByImageId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getDownloadsRelatedByImageIdJoinCategory($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/download/om/om/BaseDownloadPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collDownloadsRelatedByImageId === null) {
			if ($this->isNew()) {
				$this->collDownloadsRelatedByImageId = array();
			} else {

				$criteria->add(DownloadPeer::IMAGE_ID, $this->getImageId());

				$this->collDownloadsRelatedByImageId = DownloadPeer::doSelectJoinCategory($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(DownloadPeer::IMAGE_ID, $this->getImageId());

			if (!isset($this->lastDownloadRelatedByImageIdCriteria) || !$this->lastDownloadRelatedByImageIdCriteria->equals($criteria)) {
				$this->collDownloadsRelatedByImageId = DownloadPeer::doSelectJoinCategory($criteria, $con);
			}
		}
		$this->lastDownloadRelatedByImageIdCriteria = $criteria;

		return $this->collDownloadsRelatedByImageId;
	}

	/**
	 * Temporary storage of collEventsRelatedByThumbnailId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initEventsRelatedByThumbnailId()
	{
		if ($this->collEventsRelatedByThumbnailId === null) {
			$this->collEventsRelatedByThumbnailId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related EventsRelatedByThumbnailId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getEventsRelatedByThumbnailId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/event/om/om/BaseEventPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collEventsRelatedByThumbnailId === null) {
			if ($this->isNew()) {
			   $this->collEventsRelatedByThumbnailId = array();
			} else {

				$criteria->add(EventPeer::THUMBNAIL_ID, $this->getImageId());

				EventPeer::addSelectColumns($criteria);
				$this->collEventsRelatedByThumbnailId = EventPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(EventPeer::THUMBNAIL_ID, $this->getImageId());

				EventPeer::addSelectColumns($criteria);
				if (!isset($this->lastEventRelatedByThumbnailIdCriteria) || !$this->lastEventRelatedByThumbnailIdCriteria->equals($criteria)) {
					$this->collEventsRelatedByThumbnailId = EventPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastEventRelatedByThumbnailIdCriteria = $criteria;
		return $this->collEventsRelatedByThumbnailId;
	}

	/**
	 * Returns the number of related EventsRelatedByThumbnailId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countEventsRelatedByThumbnailId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/event/om/om/BaseEventPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(EventPeer::THUMBNAIL_ID, $this->getImageId());

		return EventPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Event object to this object
	 * through the Event foreign key attribute
	 *
	 * @param Event $l Event
	 * @return void
	 * @throws PropelException
	 */
	public function addEventRelatedByThumbnailId(Event $l)
	{
		$this->collEventsRelatedByThumbnailId[] = $l;
		$l->setImageRelatedByThumbnailId($this);
	}

	/**
	 * Temporary storage of collEventsRelatedByImageId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initEventsRelatedByImageId()
	{
		if ($this->collEventsRelatedByImageId === null) {
			$this->collEventsRelatedByImageId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related EventsRelatedByImageId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getEventsRelatedByImageId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/event/om/om/BaseEventPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collEventsRelatedByImageId === null) {
			if ($this->isNew()) {
			   $this->collEventsRelatedByImageId = array();
			} else {

				$criteria->add(EventPeer::IMAGE_ID, $this->getImageId());

				EventPeer::addSelectColumns($criteria);
				$this->collEventsRelatedByImageId = EventPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(EventPeer::IMAGE_ID, $this->getImageId());

				EventPeer::addSelectColumns($criteria);
				if (!isset($this->lastEventRelatedByImageIdCriteria) || !$this->lastEventRelatedByImageIdCriteria->equals($criteria)) {
					$this->collEventsRelatedByImageId = EventPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastEventRelatedByImageIdCriteria = $criteria;
		return $this->collEventsRelatedByImageId;
	}

	/**
	 * Returns the number of related EventsRelatedByImageId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countEventsRelatedByImageId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/event/om/om/BaseEventPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(EventPeer::IMAGE_ID, $this->getImageId());

		return EventPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Event object to this object
	 * through the Event foreign key attribute
	 *
	 * @param Event $l Event
	 * @return void
	 * @throws PropelException
	 */
	public function addEventRelatedByImageId(Event $l)
	{
		$this->collEventsRelatedByImageId[] = $l;
		$l->setImageRelatedByImageId($this);
	}

	/**
	 * Temporary storage of collGallerysRelatedByThumbnailId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initGallerysRelatedByThumbnailId()
	{
		if ($this->collGallerysRelatedByThumbnailId === null) {
			$this->collGallerysRelatedByThumbnailId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related GallerysRelatedByThumbnailId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getGallerysRelatedByThumbnailId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/gallery/om/om/BaseGalleryPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collGallerysRelatedByThumbnailId === null) {
			if ($this->isNew()) {
			   $this->collGallerysRelatedByThumbnailId = array();
			} else {

				$criteria->add(GalleryPeer::THUMBNAIL_ID, $this->getImageId());

				GalleryPeer::addSelectColumns($criteria);
				$this->collGallerysRelatedByThumbnailId = GalleryPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(GalleryPeer::THUMBNAIL_ID, $this->getImageId());

				GalleryPeer::addSelectColumns($criteria);
				if (!isset($this->lastGalleryRelatedByThumbnailIdCriteria) || !$this->lastGalleryRelatedByThumbnailIdCriteria->equals($criteria)) {
					$this->collGallerysRelatedByThumbnailId = GalleryPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastGalleryRelatedByThumbnailIdCriteria = $criteria;
		return $this->collGallerysRelatedByThumbnailId;
	}

	/**
	 * Returns the number of related GallerysRelatedByThumbnailId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countGallerysRelatedByThumbnailId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/gallery/om/om/BaseGalleryPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(GalleryPeer::THUMBNAIL_ID, $this->getImageId());

		return GalleryPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Gallery object to this object
	 * through the Gallery foreign key attribute
	 *
	 * @param Gallery $l Gallery
	 * @return void
	 * @throws PropelException
	 */
	public function addGalleryRelatedByThumbnailId(Gallery $l)
	{
		$this->collGallerysRelatedByThumbnailId[] = $l;
		$l->setImageRelatedByThumbnailId($this);
	}

	/**
	 * Temporary storage of collGallerysRelatedByImageId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initGallerysRelatedByImageId()
	{
		if ($this->collGallerysRelatedByImageId === null) {
			$this->collGallerysRelatedByImageId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related GallerysRelatedByImageId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getGallerysRelatedByImageId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/gallery/om/om/BaseGalleryPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collGallerysRelatedByImageId === null) {
			if ($this->isNew()) {
			   $this->collGallerysRelatedByImageId = array();
			} else {

				$criteria->add(GalleryPeer::IMAGE_ID, $this->getImageId());

				GalleryPeer::addSelectColumns($criteria);
				$this->collGallerysRelatedByImageId = GalleryPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(GalleryPeer::IMAGE_ID, $this->getImageId());

				GalleryPeer::addSelectColumns($criteria);
				if (!isset($this->lastGalleryRelatedByImageIdCriteria) || !$this->lastGalleryRelatedByImageIdCriteria->equals($criteria)) {
					$this->collGallerysRelatedByImageId = GalleryPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastGalleryRelatedByImageIdCriteria = $criteria;
		return $this->collGallerysRelatedByImageId;
	}

	/**
	 * Returns the number of related GallerysRelatedByImageId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countGallerysRelatedByImageId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/gallery/om/om/BaseGalleryPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(GalleryPeer::IMAGE_ID, $this->getImageId());

		return GalleryPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Gallery object to this object
	 * through the Gallery foreign key attribute
	 *
	 * @param Gallery $l Gallery
	 * @return void
	 * @throws PropelException
	 */
	public function addGalleryRelatedByImageId(Gallery $l)
	{
		$this->collGallerysRelatedByImageId[] = $l;
		$l->setImageRelatedByImageId($this);
	}

	/**
	 * Temporary storage of collGalleryImagesRelatedByThumbnailId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initGalleryImagesRelatedByThumbnailId()
	{
		if ($this->collGalleryImagesRelatedByThumbnailId === null) {
			$this->collGalleryImagesRelatedByThumbnailId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related GalleryImagesRelatedByThumbnailId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getGalleryImagesRelatedByThumbnailId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/gallery/om/om/BaseGalleryImagePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collGalleryImagesRelatedByThumbnailId === null) {
			if ($this->isNew()) {
			   $this->collGalleryImagesRelatedByThumbnailId = array();
			} else {

				$criteria->add(GalleryImagePeer::THUMBNAIL_ID, $this->getImageId());

				GalleryImagePeer::addSelectColumns($criteria);
				$this->collGalleryImagesRelatedByThumbnailId = GalleryImagePeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(GalleryImagePeer::THUMBNAIL_ID, $this->getImageId());

				GalleryImagePeer::addSelectColumns($criteria);
				if (!isset($this->lastGalleryImageRelatedByThumbnailIdCriteria) || !$this->lastGalleryImageRelatedByThumbnailIdCriteria->equals($criteria)) {
					$this->collGalleryImagesRelatedByThumbnailId = GalleryImagePeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastGalleryImageRelatedByThumbnailIdCriteria = $criteria;
		return $this->collGalleryImagesRelatedByThumbnailId;
	}

	/**
	 * Returns the number of related GalleryImagesRelatedByThumbnailId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countGalleryImagesRelatedByThumbnailId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/gallery/om/om/BaseGalleryImagePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(GalleryImagePeer::THUMBNAIL_ID, $this->getImageId());

		return GalleryImagePeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a GalleryImage object to this object
	 * through the GalleryImage foreign key attribute
	 *
	 * @param GalleryImage $l GalleryImage
	 * @return void
	 * @throws PropelException
	 */
	public function addGalleryImageRelatedByThumbnailId(GalleryImage $l)
	{
		$this->collGalleryImagesRelatedByThumbnailId[] = $l;
		$l->setImageRelatedByThumbnailId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related GalleryImagesRelatedByThumbnailId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getGalleryImagesRelatedByThumbnailIdJoinGallery($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/gallery/om/om/BaseGalleryImagePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collGalleryImagesRelatedByThumbnailId === null) {
			if ($this->isNew()) {
				$this->collGalleryImagesRelatedByThumbnailId = array();
			} else {

				$criteria->add(GalleryImagePeer::THUMBNAIL_ID, $this->getImageId());

				$this->collGalleryImagesRelatedByThumbnailId = GalleryImagePeer::doSelectJoinGallery($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(GalleryImagePeer::THUMBNAIL_ID, $this->getImageId());

			if (!isset($this->lastGalleryImageRelatedByThumbnailIdCriteria) || !$this->lastGalleryImageRelatedByThumbnailIdCriteria->equals($criteria)) {
				$this->collGalleryImagesRelatedByThumbnailId = GalleryImagePeer::doSelectJoinGallery($criteria, $con);
			}
		}
		$this->lastGalleryImageRelatedByThumbnailIdCriteria = $criteria;

		return $this->collGalleryImagesRelatedByThumbnailId;
	}

	/**
	 * Temporary storage of collGalleryImagesRelatedByImageId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initGalleryImagesRelatedByImageId()
	{
		if ($this->collGalleryImagesRelatedByImageId === null) {
			$this->collGalleryImagesRelatedByImageId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related GalleryImagesRelatedByImageId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getGalleryImagesRelatedByImageId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/gallery/om/om/BaseGalleryImagePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collGalleryImagesRelatedByImageId === null) {
			if ($this->isNew()) {
			   $this->collGalleryImagesRelatedByImageId = array();
			} else {

				$criteria->add(GalleryImagePeer::IMAGE_ID, $this->getImageId());

				GalleryImagePeer::addSelectColumns($criteria);
				$this->collGalleryImagesRelatedByImageId = GalleryImagePeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(GalleryImagePeer::IMAGE_ID, $this->getImageId());

				GalleryImagePeer::addSelectColumns($criteria);
				if (!isset($this->lastGalleryImageRelatedByImageIdCriteria) || !$this->lastGalleryImageRelatedByImageIdCriteria->equals($criteria)) {
					$this->collGalleryImagesRelatedByImageId = GalleryImagePeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastGalleryImageRelatedByImageIdCriteria = $criteria;
		return $this->collGalleryImagesRelatedByImageId;
	}

	/**
	 * Returns the number of related GalleryImagesRelatedByImageId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countGalleryImagesRelatedByImageId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/gallery/om/om/BaseGalleryImagePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(GalleryImagePeer::IMAGE_ID, $this->getImageId());

		return GalleryImagePeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a GalleryImage object to this object
	 * through the GalleryImage foreign key attribute
	 *
	 * @param GalleryImage $l GalleryImage
	 * @return void
	 * @throws PropelException
	 */
	public function addGalleryImageRelatedByImageId(GalleryImage $l)
	{
		$this->collGalleryImagesRelatedByImageId[] = $l;
		$l->setImageRelatedByImageId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related GalleryImagesRelatedByImageId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getGalleryImagesRelatedByImageIdJoinGallery($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/gallery/om/om/BaseGalleryImagePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collGalleryImagesRelatedByImageId === null) {
			if ($this->isNew()) {
				$this->collGalleryImagesRelatedByImageId = array();
			} else {

				$criteria->add(GalleryImagePeer::IMAGE_ID, $this->getImageId());

				$this->collGalleryImagesRelatedByImageId = GalleryImagePeer::doSelectJoinGallery($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(GalleryImagePeer::IMAGE_ID, $this->getImageId());

			if (!isset($this->lastGalleryImageRelatedByImageIdCriteria) || !$this->lastGalleryImageRelatedByImageIdCriteria->equals($criteria)) {
				$this->collGalleryImagesRelatedByImageId = GalleryImagePeer::doSelectJoinGallery($criteria, $con);
			}
		}
		$this->lastGalleryImageRelatedByImageIdCriteria = $criteria;

		return $this->collGalleryImagesRelatedByImageId;
	}

	/**
	 * Temporary storage of collGuidesRelatedByThumbnailId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initGuidesRelatedByThumbnailId()
	{
		if ($this->collGuidesRelatedByThumbnailId === null) {
			$this->collGuidesRelatedByThumbnailId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related GuidesRelatedByThumbnailId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getGuidesRelatedByThumbnailId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/guide/om/om/BaseGuidePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collGuidesRelatedByThumbnailId === null) {
			if ($this->isNew()) {
			   $this->collGuidesRelatedByThumbnailId = array();
			} else {

				$criteria->add(GuidePeer::THUMBNAIL_ID, $this->getImageId());

				GuidePeer::addSelectColumns($criteria);
				$this->collGuidesRelatedByThumbnailId = GuidePeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(GuidePeer::THUMBNAIL_ID, $this->getImageId());

				GuidePeer::addSelectColumns($criteria);
				if (!isset($this->lastGuideRelatedByThumbnailIdCriteria) || !$this->lastGuideRelatedByThumbnailIdCriteria->equals($criteria)) {
					$this->collGuidesRelatedByThumbnailId = GuidePeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastGuideRelatedByThumbnailIdCriteria = $criteria;
		return $this->collGuidesRelatedByThumbnailId;
	}

	/**
	 * Returns the number of related GuidesRelatedByThumbnailId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countGuidesRelatedByThumbnailId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/guide/om/om/BaseGuidePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(GuidePeer::THUMBNAIL_ID, $this->getImageId());

		return GuidePeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Guide object to this object
	 * through the Guide foreign key attribute
	 *
	 * @param Guide $l Guide
	 * @return void
	 * @throws PropelException
	 */
	public function addGuideRelatedByThumbnailId(Guide $l)
	{
		$this->collGuidesRelatedByThumbnailId[] = $l;
		$l->setImageRelatedByThumbnailId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related GuidesRelatedByThumbnailId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getGuidesRelatedByThumbnailIdJoinCountry($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/guide/om/om/BaseGuidePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collGuidesRelatedByThumbnailId === null) {
			if ($this->isNew()) {
				$this->collGuidesRelatedByThumbnailId = array();
			} else {

				$criteria->add(GuidePeer::THUMBNAIL_ID, $this->getImageId());

				$this->collGuidesRelatedByThumbnailId = GuidePeer::doSelectJoinCountry($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(GuidePeer::THUMBNAIL_ID, $this->getImageId());

			if (!isset($this->lastGuideRelatedByThumbnailIdCriteria) || !$this->lastGuideRelatedByThumbnailIdCriteria->equals($criteria)) {
				$this->collGuidesRelatedByThumbnailId = GuidePeer::doSelectJoinCountry($criteria, $con);
			}
		}
		$this->lastGuideRelatedByThumbnailIdCriteria = $criteria;

		return $this->collGuidesRelatedByThumbnailId;
	}

	/**
	 * Temporary storage of collGuidesRelatedByImageId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initGuidesRelatedByImageId()
	{
		if ($this->collGuidesRelatedByImageId === null) {
			$this->collGuidesRelatedByImageId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related GuidesRelatedByImageId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getGuidesRelatedByImageId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/guide/om/om/BaseGuidePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collGuidesRelatedByImageId === null) {
			if ($this->isNew()) {
			   $this->collGuidesRelatedByImageId = array();
			} else {

				$criteria->add(GuidePeer::IMAGE_ID, $this->getImageId());

				GuidePeer::addSelectColumns($criteria);
				$this->collGuidesRelatedByImageId = GuidePeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(GuidePeer::IMAGE_ID, $this->getImageId());

				GuidePeer::addSelectColumns($criteria);
				if (!isset($this->lastGuideRelatedByImageIdCriteria) || !$this->lastGuideRelatedByImageIdCriteria->equals($criteria)) {
					$this->collGuidesRelatedByImageId = GuidePeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastGuideRelatedByImageIdCriteria = $criteria;
		return $this->collGuidesRelatedByImageId;
	}

	/**
	 * Returns the number of related GuidesRelatedByImageId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countGuidesRelatedByImageId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/guide/om/om/BaseGuidePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(GuidePeer::IMAGE_ID, $this->getImageId());

		return GuidePeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Guide object to this object
	 * through the Guide foreign key attribute
	 *
	 * @param Guide $l Guide
	 * @return void
	 * @throws PropelException
	 */
	public function addGuideRelatedByImageId(Guide $l)
	{
		$this->collGuidesRelatedByImageId[] = $l;
		$l->setImageRelatedByImageId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related GuidesRelatedByImageId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getGuidesRelatedByImageIdJoinCountry($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/guide/om/om/BaseGuidePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collGuidesRelatedByImageId === null) {
			if ($this->isNew()) {
				$this->collGuidesRelatedByImageId = array();
			} else {

				$criteria->add(GuidePeer::IMAGE_ID, $this->getImageId());

				$this->collGuidesRelatedByImageId = GuidePeer::doSelectJoinCountry($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(GuidePeer::IMAGE_ID, $this->getImageId());

			if (!isset($this->lastGuideRelatedByImageIdCriteria) || !$this->lastGuideRelatedByImageIdCriteria->equals($criteria)) {
				$this->collGuidesRelatedByImageId = GuidePeer::doSelectJoinCountry($criteria, $con);
			}
		}
		$this->lastGuideRelatedByImageIdCriteria = $criteria;

		return $this->collGuidesRelatedByImageId;
	}

	/**
	 * Temporary storage of collTinyImagesRelatedByImageId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initTinyImagesRelatedByImageId()
	{
		if ($this->collTinyImagesRelatedByImageId === null) {
			$this->collTinyImagesRelatedByImageId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related TinyImagesRelatedByImageId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getTinyImagesRelatedByImageId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/image/om/om/BaseTinyImagePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collTinyImagesRelatedByImageId === null) {
			if ($this->isNew()) {
			   $this->collTinyImagesRelatedByImageId = array();
			} else {

				$criteria->add(TinyImagePeer::IMAGE_ID, $this->getImageId());

				TinyImagePeer::addSelectColumns($criteria);
				$this->collTinyImagesRelatedByImageId = TinyImagePeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(TinyImagePeer::IMAGE_ID, $this->getImageId());

				TinyImagePeer::addSelectColumns($criteria);
				if (!isset($this->lastTinyImageRelatedByImageIdCriteria) || !$this->lastTinyImageRelatedByImageIdCriteria->equals($criteria)) {
					$this->collTinyImagesRelatedByImageId = TinyImagePeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastTinyImageRelatedByImageIdCriteria = $criteria;
		return $this->collTinyImagesRelatedByImageId;
	}

	/**
	 * Returns the number of related TinyImagesRelatedByImageId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countTinyImagesRelatedByImageId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/image/om/om/BaseTinyImagePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(TinyImagePeer::IMAGE_ID, $this->getImageId());

		return TinyImagePeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a TinyImage object to this object
	 * through the TinyImage foreign key attribute
	 *
	 * @param TinyImage $l TinyImage
	 * @return void
	 * @throws PropelException
	 */
	public function addTinyImageRelatedByImageId(TinyImage $l)
	{
		$this->collTinyImagesRelatedByImageId[] = $l;
		$l->setImageRelatedByImageId($this);
	}

	/**
	 * Temporary storage of collTinyImagesRelatedByThumbnailId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initTinyImagesRelatedByThumbnailId()
	{
		if ($this->collTinyImagesRelatedByThumbnailId === null) {
			$this->collTinyImagesRelatedByThumbnailId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related TinyImagesRelatedByThumbnailId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getTinyImagesRelatedByThumbnailId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/image/om/om/BaseTinyImagePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collTinyImagesRelatedByThumbnailId === null) {
			if ($this->isNew()) {
			   $this->collTinyImagesRelatedByThumbnailId = array();
			} else {

				$criteria->add(TinyImagePeer::THUMBNAIL_ID, $this->getImageId());

				TinyImagePeer::addSelectColumns($criteria);
				$this->collTinyImagesRelatedByThumbnailId = TinyImagePeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(TinyImagePeer::THUMBNAIL_ID, $this->getImageId());

				TinyImagePeer::addSelectColumns($criteria);
				if (!isset($this->lastTinyImageRelatedByThumbnailIdCriteria) || !$this->lastTinyImageRelatedByThumbnailIdCriteria->equals($criteria)) {
					$this->collTinyImagesRelatedByThumbnailId = TinyImagePeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastTinyImageRelatedByThumbnailIdCriteria = $criteria;
		return $this->collTinyImagesRelatedByThumbnailId;
	}

	/**
	 * Returns the number of related TinyImagesRelatedByThumbnailId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countTinyImagesRelatedByThumbnailId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/image/om/om/BaseTinyImagePeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(TinyImagePeer::THUMBNAIL_ID, $this->getImageId());

		return TinyImagePeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a TinyImage object to this object
	 * through the TinyImage foreign key attribute
	 *
	 * @param TinyImage $l TinyImage
	 * @return void
	 * @throws PropelException
	 */
	public function addTinyImageRelatedByThumbnailId(TinyImage $l)
	{
		$this->collTinyImagesRelatedByThumbnailId[] = $l;
		$l->setImageRelatedByThumbnailId($this);
	}

	/**
	 * Temporary storage of collMenuItemsRelatedByThumbnailId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initMenuItemsRelatedByThumbnailId()
	{
		if ($this->collMenuItemsRelatedByThumbnailId === null) {
			$this->collMenuItemsRelatedByThumbnailId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related MenuItemsRelatedByThumbnailId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getMenuItemsRelatedByThumbnailId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuItemPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collMenuItemsRelatedByThumbnailId === null) {
			if ($this->isNew()) {
			   $this->collMenuItemsRelatedByThumbnailId = array();
			} else {

				$criteria->add(MenuItemPeer::THUMBNAIL_ID, $this->getImageId());

				MenuItemPeer::addSelectColumns($criteria);
				$this->collMenuItemsRelatedByThumbnailId = MenuItemPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(MenuItemPeer::THUMBNAIL_ID, $this->getImageId());

				MenuItemPeer::addSelectColumns($criteria);
				if (!isset($this->lastMenuItemRelatedByThumbnailIdCriteria) || !$this->lastMenuItemRelatedByThumbnailIdCriteria->equals($criteria)) {
					$this->collMenuItemsRelatedByThumbnailId = MenuItemPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastMenuItemRelatedByThumbnailIdCriteria = $criteria;
		return $this->collMenuItemsRelatedByThumbnailId;
	}

	/**
	 * Returns the number of related MenuItemsRelatedByThumbnailId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countMenuItemsRelatedByThumbnailId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuItemPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(MenuItemPeer::THUMBNAIL_ID, $this->getImageId());

		return MenuItemPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a MenuItem object to this object
	 * through the MenuItem foreign key attribute
	 *
	 * @param MenuItem $l MenuItem
	 * @return void
	 * @throws PropelException
	 */
	public function addMenuItemRelatedByThumbnailId(MenuItem $l)
	{
		$this->collMenuItemsRelatedByThumbnailId[] = $l;
		$l->setImageRelatedByThumbnailId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related MenuItemsRelatedByThumbnailId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getMenuItemsRelatedByThumbnailIdJoinCategory($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuItemPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collMenuItemsRelatedByThumbnailId === null) {
			if ($this->isNew()) {
				$this->collMenuItemsRelatedByThumbnailId = array();
			} else {

				$criteria->add(MenuItemPeer::THUMBNAIL_ID, $this->getImageId());

				$this->collMenuItemsRelatedByThumbnailId = MenuItemPeer::doSelectJoinCategory($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(MenuItemPeer::THUMBNAIL_ID, $this->getImageId());

			if (!isset($this->lastMenuItemRelatedByThumbnailIdCriteria) || !$this->lastMenuItemRelatedByThumbnailIdCriteria->equals($criteria)) {
				$this->collMenuItemsRelatedByThumbnailId = MenuItemPeer::doSelectJoinCategory($criteria, $con);
			}
		}
		$this->lastMenuItemRelatedByThumbnailIdCriteria = $criteria;

		return $this->collMenuItemsRelatedByThumbnailId;
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related MenuItemsRelatedByThumbnailId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getMenuItemsRelatedByThumbnailIdJoinMenu($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuItemPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collMenuItemsRelatedByThumbnailId === null) {
			if ($this->isNew()) {
				$this->collMenuItemsRelatedByThumbnailId = array();
			} else {

				$criteria->add(MenuItemPeer::THUMBNAIL_ID, $this->getImageId());

				$this->collMenuItemsRelatedByThumbnailId = MenuItemPeer::doSelectJoinMenu($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(MenuItemPeer::THUMBNAIL_ID, $this->getImageId());

			if (!isset($this->lastMenuItemRelatedByThumbnailIdCriteria) || !$this->lastMenuItemRelatedByThumbnailIdCriteria->equals($criteria)) {
				$this->collMenuItemsRelatedByThumbnailId = MenuItemPeer::doSelectJoinMenu($criteria, $con);
			}
		}
		$this->lastMenuItemRelatedByThumbnailIdCriteria = $criteria;

		return $this->collMenuItemsRelatedByThumbnailId;
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related MenuItemsRelatedByThumbnailId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getMenuItemsRelatedByThumbnailIdJoinMenuItemRelatedByParentId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuItemPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collMenuItemsRelatedByThumbnailId === null) {
			if ($this->isNew()) {
				$this->collMenuItemsRelatedByThumbnailId = array();
			} else {

				$criteria->add(MenuItemPeer::THUMBNAIL_ID, $this->getImageId());

				$this->collMenuItemsRelatedByThumbnailId = MenuItemPeer::doSelectJoinMenuItemRelatedByParentId($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(MenuItemPeer::THUMBNAIL_ID, $this->getImageId());

			if (!isset($this->lastMenuItemRelatedByThumbnailIdCriteria) || !$this->lastMenuItemRelatedByThumbnailIdCriteria->equals($criteria)) {
				$this->collMenuItemsRelatedByThumbnailId = MenuItemPeer::doSelectJoinMenuItemRelatedByParentId($criteria, $con);
			}
		}
		$this->lastMenuItemRelatedByThumbnailIdCriteria = $criteria;

		return $this->collMenuItemsRelatedByThumbnailId;
	}

	/**
	 * Temporary storage of collMenuItemsRelatedByImageId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initMenuItemsRelatedByImageId()
	{
		if ($this->collMenuItemsRelatedByImageId === null) {
			$this->collMenuItemsRelatedByImageId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related MenuItemsRelatedByImageId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getMenuItemsRelatedByImageId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuItemPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collMenuItemsRelatedByImageId === null) {
			if ($this->isNew()) {
			   $this->collMenuItemsRelatedByImageId = array();
			} else {

				$criteria->add(MenuItemPeer::IMAGE_ID, $this->getImageId());

				MenuItemPeer::addSelectColumns($criteria);
				$this->collMenuItemsRelatedByImageId = MenuItemPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(MenuItemPeer::IMAGE_ID, $this->getImageId());

				MenuItemPeer::addSelectColumns($criteria);
				if (!isset($this->lastMenuItemRelatedByImageIdCriteria) || !$this->lastMenuItemRelatedByImageIdCriteria->equals($criteria)) {
					$this->collMenuItemsRelatedByImageId = MenuItemPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastMenuItemRelatedByImageIdCriteria = $criteria;
		return $this->collMenuItemsRelatedByImageId;
	}

	/**
	 * Returns the number of related MenuItemsRelatedByImageId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countMenuItemsRelatedByImageId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuItemPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(MenuItemPeer::IMAGE_ID, $this->getImageId());

		return MenuItemPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a MenuItem object to this object
	 * through the MenuItem foreign key attribute
	 *
	 * @param MenuItem $l MenuItem
	 * @return void
	 * @throws PropelException
	 */
	public function addMenuItemRelatedByImageId(MenuItem $l)
	{
		$this->collMenuItemsRelatedByImageId[] = $l;
		$l->setImageRelatedByImageId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related MenuItemsRelatedByImageId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getMenuItemsRelatedByImageIdJoinCategory($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuItemPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collMenuItemsRelatedByImageId === null) {
			if ($this->isNew()) {
				$this->collMenuItemsRelatedByImageId = array();
			} else {

				$criteria->add(MenuItemPeer::IMAGE_ID, $this->getImageId());

				$this->collMenuItemsRelatedByImageId = MenuItemPeer::doSelectJoinCategory($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(MenuItemPeer::IMAGE_ID, $this->getImageId());

			if (!isset($this->lastMenuItemRelatedByImageIdCriteria) || !$this->lastMenuItemRelatedByImageIdCriteria->equals($criteria)) {
				$this->collMenuItemsRelatedByImageId = MenuItemPeer::doSelectJoinCategory($criteria, $con);
			}
		}
		$this->lastMenuItemRelatedByImageIdCriteria = $criteria;

		return $this->collMenuItemsRelatedByImageId;
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related MenuItemsRelatedByImageId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getMenuItemsRelatedByImageIdJoinMenu($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuItemPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collMenuItemsRelatedByImageId === null) {
			if ($this->isNew()) {
				$this->collMenuItemsRelatedByImageId = array();
			} else {

				$criteria->add(MenuItemPeer::IMAGE_ID, $this->getImageId());

				$this->collMenuItemsRelatedByImageId = MenuItemPeer::doSelectJoinMenu($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(MenuItemPeer::IMAGE_ID, $this->getImageId());

			if (!isset($this->lastMenuItemRelatedByImageIdCriteria) || !$this->lastMenuItemRelatedByImageIdCriteria->equals($criteria)) {
				$this->collMenuItemsRelatedByImageId = MenuItemPeer::doSelectJoinMenu($criteria, $con);
			}
		}
		$this->lastMenuItemRelatedByImageIdCriteria = $criteria;

		return $this->collMenuItemsRelatedByImageId;
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related MenuItemsRelatedByImageId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getMenuItemsRelatedByImageIdJoinMenuItemRelatedByParentId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/menu/om/om/BaseMenuItemPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collMenuItemsRelatedByImageId === null) {
			if ($this->isNew()) {
				$this->collMenuItemsRelatedByImageId = array();
			} else {

				$criteria->add(MenuItemPeer::IMAGE_ID, $this->getImageId());

				$this->collMenuItemsRelatedByImageId = MenuItemPeer::doSelectJoinMenuItemRelatedByParentId($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(MenuItemPeer::IMAGE_ID, $this->getImageId());

			if (!isset($this->lastMenuItemRelatedByImageIdCriteria) || !$this->lastMenuItemRelatedByImageIdCriteria->equals($criteria)) {
				$this->collMenuItemsRelatedByImageId = MenuItemPeer::doSelectJoinMenuItemRelatedByParentId($criteria, $con);
			}
		}
		$this->lastMenuItemRelatedByImageIdCriteria = $criteria;

		return $this->collMenuItemsRelatedByImageId;
	}

	/**
	 * Temporary storage of collProjectsRelatedByThumbnailId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initProjectsRelatedByThumbnailId()
	{
		if ($this->collProjectsRelatedByThumbnailId === null) {
			$this->collProjectsRelatedByThumbnailId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related ProjectsRelatedByThumbnailId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getProjectsRelatedByThumbnailId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/project/om/om/BaseProjectPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collProjectsRelatedByThumbnailId === null) {
			if ($this->isNew()) {
			   $this->collProjectsRelatedByThumbnailId = array();
			} else {

				$criteria->add(ProjectPeer::THUMBNAIL_ID, $this->getImageId());

				ProjectPeer::addSelectColumns($criteria);
				$this->collProjectsRelatedByThumbnailId = ProjectPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(ProjectPeer::THUMBNAIL_ID, $this->getImageId());

				ProjectPeer::addSelectColumns($criteria);
				if (!isset($this->lastProjectRelatedByThumbnailIdCriteria) || !$this->lastProjectRelatedByThumbnailIdCriteria->equals($criteria)) {
					$this->collProjectsRelatedByThumbnailId = ProjectPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastProjectRelatedByThumbnailIdCriteria = $criteria;
		return $this->collProjectsRelatedByThumbnailId;
	}

	/**
	 * Returns the number of related ProjectsRelatedByThumbnailId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countProjectsRelatedByThumbnailId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/project/om/om/BaseProjectPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ProjectPeer::THUMBNAIL_ID, $this->getImageId());

		return ProjectPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Project object to this object
	 * through the Project foreign key attribute
	 *
	 * @param Project $l Project
	 * @return void
	 * @throws PropelException
	 */
	public function addProjectRelatedByThumbnailId(Project $l)
	{
		$this->collProjectsRelatedByThumbnailId[] = $l;
		$l->setImageRelatedByThumbnailId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related ProjectsRelatedByThumbnailId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getProjectsRelatedByThumbnailIdJoinCategory($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/project/om/om/BaseProjectPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collProjectsRelatedByThumbnailId === null) {
			if ($this->isNew()) {
				$this->collProjectsRelatedByThumbnailId = array();
			} else {

				$criteria->add(ProjectPeer::THUMBNAIL_ID, $this->getImageId());

				$this->collProjectsRelatedByThumbnailId = ProjectPeer::doSelectJoinCategory($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(ProjectPeer::THUMBNAIL_ID, $this->getImageId());

			if (!isset($this->lastProjectRelatedByThumbnailIdCriteria) || !$this->lastProjectRelatedByThumbnailIdCriteria->equals($criteria)) {
				$this->collProjectsRelatedByThumbnailId = ProjectPeer::doSelectJoinCategory($criteria, $con);
			}
		}
		$this->lastProjectRelatedByThumbnailIdCriteria = $criteria;

		return $this->collProjectsRelatedByThumbnailId;
	}

	/**
	 * Temporary storage of collProjectsRelatedByImageId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initProjectsRelatedByImageId()
	{
		if ($this->collProjectsRelatedByImageId === null) {
			$this->collProjectsRelatedByImageId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related ProjectsRelatedByImageId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getProjectsRelatedByImageId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/project/om/om/BaseProjectPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collProjectsRelatedByImageId === null) {
			if ($this->isNew()) {
			   $this->collProjectsRelatedByImageId = array();
			} else {

				$criteria->add(ProjectPeer::IMAGE_ID, $this->getImageId());

				ProjectPeer::addSelectColumns($criteria);
				$this->collProjectsRelatedByImageId = ProjectPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(ProjectPeer::IMAGE_ID, $this->getImageId());

				ProjectPeer::addSelectColumns($criteria);
				if (!isset($this->lastProjectRelatedByImageIdCriteria) || !$this->lastProjectRelatedByImageIdCriteria->equals($criteria)) {
					$this->collProjectsRelatedByImageId = ProjectPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastProjectRelatedByImageIdCriteria = $criteria;
		return $this->collProjectsRelatedByImageId;
	}

	/**
	 * Returns the number of related ProjectsRelatedByImageId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countProjectsRelatedByImageId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/project/om/om/BaseProjectPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ProjectPeer::IMAGE_ID, $this->getImageId());

		return ProjectPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Project object to this object
	 * through the Project foreign key attribute
	 *
	 * @param Project $l Project
	 * @return void
	 * @throws PropelException
	 */
	public function addProjectRelatedByImageId(Project $l)
	{
		$this->collProjectsRelatedByImageId[] = $l;
		$l->setImageRelatedByImageId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related ProjectsRelatedByImageId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getProjectsRelatedByImageIdJoinCategory($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/project/om/om/BaseProjectPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collProjectsRelatedByImageId === null) {
			if ($this->isNew()) {
				$this->collProjectsRelatedByImageId = array();
			} else {

				$criteria->add(ProjectPeer::IMAGE_ID, $this->getImageId());

				$this->collProjectsRelatedByImageId = ProjectPeer::doSelectJoinCategory($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(ProjectPeer::IMAGE_ID, $this->getImageId());

			if (!isset($this->lastProjectRelatedByImageIdCriteria) || !$this->lastProjectRelatedByImageIdCriteria->equals($criteria)) {
				$this->collProjectsRelatedByImageId = ProjectPeer::doSelectJoinCategory($criteria, $con);
			}
		}
		$this->lastProjectRelatedByImageIdCriteria = $criteria;

		return $this->collProjectsRelatedByImageId;
	}

	/**
	 * Temporary storage of collStaffsRelatedByThumbnailId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initStaffsRelatedByThumbnailId()
	{
		if ($this->collStaffsRelatedByThumbnailId === null) {
			$this->collStaffsRelatedByThumbnailId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related StaffsRelatedByThumbnailId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getStaffsRelatedByThumbnailId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/staff/om/om/BaseStaffPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collStaffsRelatedByThumbnailId === null) {
			if ($this->isNew()) {
			   $this->collStaffsRelatedByThumbnailId = array();
			} else {

				$criteria->add(StaffPeer::THUMBNAIL_ID, $this->getImageId());

				StaffPeer::addSelectColumns($criteria);
				$this->collStaffsRelatedByThumbnailId = StaffPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(StaffPeer::THUMBNAIL_ID, $this->getImageId());

				StaffPeer::addSelectColumns($criteria);
				if (!isset($this->lastStaffRelatedByThumbnailIdCriteria) || !$this->lastStaffRelatedByThumbnailIdCriteria->equals($criteria)) {
					$this->collStaffsRelatedByThumbnailId = StaffPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastStaffRelatedByThumbnailIdCriteria = $criteria;
		return $this->collStaffsRelatedByThumbnailId;
	}

	/**
	 * Returns the number of related StaffsRelatedByThumbnailId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countStaffsRelatedByThumbnailId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/staff/om/om/BaseStaffPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(StaffPeer::THUMBNAIL_ID, $this->getImageId());

		return StaffPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Staff object to this object
	 * through the Staff foreign key attribute
	 *
	 * @param Staff $l Staff
	 * @return void
	 * @throws PropelException
	 */
	public function addStaffRelatedByThumbnailId(Staff $l)
	{
		$this->collStaffsRelatedByThumbnailId[] = $l;
		$l->setImageRelatedByThumbnailId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related StaffsRelatedByThumbnailId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getStaffsRelatedByThumbnailIdJoinLanguage($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/staff/om/om/BaseStaffPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collStaffsRelatedByThumbnailId === null) {
			if ($this->isNew()) {
				$this->collStaffsRelatedByThumbnailId = array();
			} else {

				$criteria->add(StaffPeer::THUMBNAIL_ID, $this->getImageId());

				$this->collStaffsRelatedByThumbnailId = StaffPeer::doSelectJoinLanguage($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(StaffPeer::THUMBNAIL_ID, $this->getImageId());

			if (!isset($this->lastStaffRelatedByThumbnailIdCriteria) || !$this->lastStaffRelatedByThumbnailIdCriteria->equals($criteria)) {
				$this->collStaffsRelatedByThumbnailId = StaffPeer::doSelectJoinLanguage($criteria, $con);
			}
		}
		$this->lastStaffRelatedByThumbnailIdCriteria = $criteria;

		return $this->collStaffsRelatedByThumbnailId;
	}

	/**
	 * Temporary storage of collStaffsRelatedByImageId to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return void
	 */
	public function initStaffsRelatedByImageId()
	{
		if ($this->collStaffsRelatedByImageId === null) {
			$this->collStaffsRelatedByImageId = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image has previously
	 * been saved, it will retrieve related StaffsRelatedByImageId from storage.
	 * If this Image is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param Connection $con
	 * @param Criteria $criteria
	 * @throws PropelException
	 */
	public function getStaffsRelatedByImageId($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/staff/om/om/BaseStaffPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collStaffsRelatedByImageId === null) {
			if ($this->isNew()) {
			   $this->collStaffsRelatedByImageId = array();
			} else {

				$criteria->add(StaffPeer::IMAGE_ID, $this->getImageId());

				StaffPeer::addSelectColumns($criteria);
				$this->collStaffsRelatedByImageId = StaffPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(StaffPeer::IMAGE_ID, $this->getImageId());

				StaffPeer::addSelectColumns($criteria);
				if (!isset($this->lastStaffRelatedByImageIdCriteria) || !$this->lastStaffRelatedByImageIdCriteria->equals($criteria)) {
					$this->collStaffsRelatedByImageId = StaffPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastStaffRelatedByImageIdCriteria = $criteria;
		return $this->collStaffsRelatedByImageId;
	}

	/**
	 * Returns the number of related StaffsRelatedByImageId.
	 *
	 * @param Criteria $criteria
	 * @param boolean $distinct
	 * @param Connection $con
	 * @throws PropelException
	 */
	public function countStaffsRelatedByImageId($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		include_once 'cms/staff/om/om/BaseStaffPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(StaffPeer::IMAGE_ID, $this->getImageId());

		return StaffPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a Staff object to this object
	 * through the Staff foreign key attribute
	 *
	 * @param Staff $l Staff
	 * @return void
	 * @throws PropelException
	 */
	public function addStaffRelatedByImageId(Staff $l)
	{
		$this->collStaffsRelatedByImageId[] = $l;
		$l->setImageRelatedByImageId($this);
	}


	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Image is new, it will return
	 * an empty collection; or if this Image has previously
	 * been saved, it will retrieve related StaffsRelatedByImageId from storage.
	 *
	 * This method is protected by default in order to keep the public
	 * api reasonable.  You can provide public methods for those you
	 * actually need in Image.
	 */
	public function getStaffsRelatedByImageIdJoinLanguage($criteria = null, $con = null)
	{
		// include the Peer class
		include_once 'cms/staff/om/om/BaseStaffPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collStaffsRelatedByImageId === null) {
			if ($this->isNew()) {
				$this->collStaffsRelatedByImageId = array();
			} else {

				$criteria->add(StaffPeer::IMAGE_ID, $this->getImageId());

				$this->collStaffsRelatedByImageId = StaffPeer::doSelectJoinLanguage($criteria, $con);
			}
		} else {
			// the following code is to determine if a new query is
			// called for.  If the criteria is the same as the last
			// one, just return the collection.

			$criteria->add(StaffPeer::IMAGE_ID, $this->getImageId());

			if (!isset($this->lastStaffRelatedByImageIdCriteria) || !$this->lastStaffRelatedByImageIdCriteria->equals($criteria)) {
				$this->collStaffsRelatedByImageId = StaffPeer::doSelectJoinLanguage($criteria, $con);
			}
		}
		$this->lastStaffRelatedByImageIdCriteria = $criteria;

		return $this->collStaffsRelatedByImageId;
	}

} // BaseImage
